<?php

namespace api\controller;

// +----------------------------------------------------------------------
// | 生产报表详情数据控制层
// +----------------------------------------------------------------------

use common\controller\VerifyController;
use common\service\ProduceStatementReportService;
use Exception;
use think\Request;
use think\Response;

class ProduceStatementReportController extends VerifyController
{
    /** @var ProduceStatementReportService $service */
    private $service;

    public function __construct()
    {
        parent::__construct();
        $this->service = ProduceStatementReportService::getInstance();
    }

    /**
     * 报表详情
     * @param Request $request
     * @return Response
     */
    public function detail(Request $request)
    {
        $param = $request->param()['param'];
        $res = $this->service->detail($param['project_id'], $param['month'], $request->getTenantId());
        return json(success_response('OK', $res));
    }

    /**
     * 管理财务数据
     * @param Request $request
     * @return Response
     * @throws Exception
     */
    public function modify(Request $request)
    {
        $data = $request->param()['data'];
        $res = $this->service->modify($data, $request->getTenantId());
        return json(success_response('OK', $res));
    }

}
